#!/usr/local/bin/perl

$tmp=$ARGV[0];

chomp($tmp);
open(FILE1,$tmp);

@lines = <FILE1>;
$no_lines = @lines;

for($i=0; $i < $no_lines; $i++)
{
	chomp($lines[$i]);
	if($lines[$i] =~ /^[0-9]+$/)
	{
		$sen_no = $lines[$i];
		for($k = $i+1;;$k++)
		{
			chomp($lines[$k]);
			if($lines[$k] !~ /^Score/)
			{
				$i++;
				($src,$tgts) = split(/\s+=>\s+/,$lines[$k]);
#		print $sen_no,"\t",$src,"\t",$tgts,"\n";
				@tgts_all = split(/_/,$tgts);
				foreach $tgt (@tgts_all)
				{
					if($tgt ne "-")
					{
					print $sen_no,"\t",$src,"\t",$tgt,"\n";
					}
				}
			}
			else
			{
				$i++;
				last;
			}
		}
	}
	elsif($lines[$i] =~ /[a-zA-Z]+/)
	{
	}
}
close (FILE1);
